//打开人人矿场App  万一以后会用
export function openApp() {
  let timeout = null;
  let ua = window.navigator.userAgent.toLowerCase();
  //微信
  if (ua.match(/MicroMessenger/i) == 'micromessenger') {
    window.location.href = 'downLoadForPhone';
  } else { //非微信浏览器
    if (navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)) {
      let loadDateTime = new Date();
      timeout = setTimeout(function() {
        let timeOutDateTime = new Date();
        if (timeOutDateTime - loadDateTime < 5000) {
          window.location = ""; //ios下载地址
        } else {
          window.close();
        }
        clearTimeout(timeout);
        timeout = null;
      }, 2000);
      window.location = "renrenmine://";
    } else if (navigator.userAgent.match(/android/i)) {
      let state = null;
      try {
        window.location = 'renrenmine://';
        timeout = setTimeout(function() {
          window.location = ""; //android下载地址
          clearTimeout(timeout);
          timeout = null;
        }, 500);
      } catch (e) {}
    }else {
      return null;
    }
  }
}
